package array;

import java.util.*;

//获取极值
public class GetMin {
    public static void main(String[] args) throws Exception {
        Integer[] numbers = { 8, 2, 7, 1, 4, 9, 5 };
        System.out.println("最小值："+ min(numbers));
        System.out.println("最大值："+ max(numbers));
    }

    private static int min(Integer[] arr) {
        int min = (int) Collections.min(Arrays.asList(arr));
        return min;
    }

    private static int max(Integer[] arr) {
        int max = (int) Collections.max(Arrays.asList(arr));
        return max;
    }

}
